import net from '@/network/net.js';
import $ from 'jquery';
import store from '@/store/store.js';

let api = {
    'getUserList': '/app/recharge/v1/getUserList',
    'getRechargeList': '/app/recharge/v1/getRechargeList',
};

let postCfg = {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    transformRequest: function(data) {
        return $.param(data)
    }
}

let res = {

};

function getUserList(page, pageSize) {
    let p = new Promise(function(resolve, reject) {
        net.req.post(api.getUserList, {
            page: page,
            pageSize: pageSize,
        }, postCfg).then(function(res) {
            resolve(res);
        }, function(error) {
            reject(error);
        });
    });
    return p;
}

function getRechargeList(page, pageSize) {
    let p = new Promise(function(resolve, reject) {
        net.req.post(api.getRechargeList, {
            page: page,
            pageSize: pageSize,
        }, postCfg).then(function(res) {
            resolve(res);
        }, function(error) {
            reject(error);
        });
    });
    return p;
}

export default {
    getUserList,
    getRechargeList,
}
